<template>
  <div class="detailMain">
    <a-row>
      <a-col>
        <div class="top-btns">
          <a-button type="primary" @click="confirmHint('', 'save')"><a-icon type="save" />保存服务商</a-button>
          <a-button type="primary" @click="edit"><a-icon type="form" />编辑</a-button>
          <a-button type="primary" @click="back"><a-icon type="rollback" />返回</a-button>
        </div>
      </a-col>
    </a-row>
    <a-collapse v-model="activeKey">
      <a-collapse-panel header="基本信息" key="1">
        <a-row :gutter="16">
          <a-col :span="8">
            <p>*类型：</p>
            <p>{{detailData.type ? '个人' : '企业'}}</p>
          </a-col>
          <a-col :span="8">
            <p>*名称：</p>
            <p>{{detailData.partner_name}}</p>
          </a-col>
          <a-col :span="8">
            <p>*手机号：</p>
            <p>{{detailData.phone}}</p>
          </a-col>
          <a-col :span="8">
            <p>*身份证号：</p>
            <p>{{detailData.identity}}</p>
          </a-col>
          <a-col :span="8">
            <p>*所属区域：</p>
            <p>{{detailData.province_name + detailData.city_name + detailData.district_name}}</p>
          </a-col>
        </a-row>
      </a-collapse-panel>
      <a-collapse-panel header="证件信息" key="2">
        <a-row :gutter="16">
          <a-col :span="8">
            <p>*推荐人姓名：</p>
            <p>{{detailData.parent_partner_name}}</p>
          </a-col>
          <a-col :span="8">
            <p>*推荐人手机号：</p>
            <p>{{detailData.parent_partner_phone}}</p>
          </a-col>
        </a-row>
      </a-collapse-panel>
      <a-collapse-panel header="证件信息" key="3" v-if="detailData.type===2">
        <a-row :gutter="16">
          <a-col :span="24">
            <p>*营业执照名称：</p>
            <p>{{detailData.license_name}}</p>
          </a-col>
          <a-col :span="24">
            <p>营业执照：</p>
            <p><img :src="detailData.license" alt=""></p>
          </a-col>
        </a-row>
      </a-collapse-panel>
      <a-collapse-panel header="结算信息" key="4">
        <a-row :gutter="16">
          <a-col :span="8">
            <p>*账户类型：</p>
            <p>{{detailData.account_type ? '对公' : '对私'}}</p>
            <!--  1对公2私人 -->
          </a-col>
          <a-col :span="8">
            <p>*银行名称：</p>
            <p>{{detailData.bankname}}</p>
          </a-col>
          <a-col :span="8">
            <p>*银行账号：</p>
            <p>{{detailData.bankcard}}</p>
          </a-col>
          <a-col :span="8">
            <p>*银行支行名称：</p>
            <p>{{detailData.branchname}}</p>
          </a-col>
          <a-col :span="8">
            <p>*开户地区：</p>
            <p>{{detailData.bank_province_name + detailData.bank_city_name + detailData.bank_district_name}}</p>
          </a-col>
        </a-row>
      </a-collapse-panel>
      <a-collapse-panel header="加盟信息" key="5">
        <a-row :gutter="16">
          <a-col :span="8">
            <p>*加盟费：</p>
            <p>{{detailData.participation}}</p>
          </a-col>
        </a-row>
      </a-collapse-panel>
    </a-collapse>
    <div class="modal-wrap">
      <a-modal
        class="common-pop"
        title="草稿箱编辑"
        v-model="visible"
        :maskClosable="false"
        :destroyOnClose="true"
        :closable="false"
        :footer="null"
      >
        <div>
          <drafts-edit
            :detailData="detailData"
          />
          <!-- @closePop="handleClosePop"
          @savePop="handleSavePop" -->
        </div>
      </a-modal>
    </div>
  </div>
</template>

<script>
import { ptInviteDraftShow } from '../../store/providerApi.js'
export default {
  components: {
    draftsEdit:()=> import('./draftsListDetailEdit.vue')
  },
  data() {
    return {
      activeKey: ['1', '2', '3', '4', '5'],
      detailData: {},
      hint: '',
      visible: false
    }
  },
  computed: {
  },
  mounted() {
    ptInviteDraftShow({
      id: this.$route.query.id
    }).then(res => {
      this.detailData = res.data
      this.isVerify = res.data.is_verify
    })
  },
  methods: {
    confirmHint (item, type) {
      if (this.isVerify === false) {
        this.$message.warning('必填信息填写不完整，无法保存成为服务商！')
      } else if (this.isVerify === true) {
        console.log('可保存')
        // if (type === 'save') {
        //   this.hint = 5
        // }
        // this.$refs.openModal.openModal()
      }
    },
    edit () {
      this.visible = true
    },
    handleClosePop () {},
    handleSavePop() {},
    back() {
      this.visible = false
    }
  }
}
</script>

<style>
</style>
